#include "trap.h"
#include "inst_test.h"
#include "asm/regdef.h"
#include "asm/asm.h"
    .set noreorder
    .set noat 
    .global main 
    .text 

main:

    ori $t0, $zero, 0           # $t0 = 0 (loop counter)
    lui $t1, 0x0001             # $t1 = 0x10000
    ori $t2, $zero, 10          # $t2 = 10 (loop limit)
loop4:
    addiu $t0, $t0, 1           # $t0 = $t0 + 1
    or $t3, $t1, $t0            # $t3 = $t1 | $t0
    sllv $t4, $t3, $t0          # $t4 = $t3 << ($t0 & 31)
    andi $t5, $t4, 0xFF         # $t5 = $t4 & 0xFF
    blez $t2, end4              # if $t2 <= 0, branch to end4
    bne $t0, $t2, loop4         # Continue loop if $t0 != $t2
end4:

    HIT_GOOD_TRAP

inst_error:
    HIT_BAD_TRAP